package models;

import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;

import common.annotation.UI_Field;
import common.annotation.UI_Model;
import common.annotation._Compnent;

@Entity
@UI_Model
public class TripStartDate extends _Model {

	@UI_Field(showName="出发时间", compnent=_Compnent.date)
	public Date tripIdCalendar ;
	@UI_Field(showName="成人价", compnent=_Compnent.input)
	public double adultPrice ;
	@UI_Field(showName="儿童价", compnent=_Compnent.input)
	public double childrenPrice ;

	/**
	 * 测试设置与trip进行双向修改
	 * 
	@UI_Field( showName="线路", compnent=_Compnent.checkbox, relationModel="trips",relationFields= {"tripName"})
	@ManyToMany
	@JoinTable(name = "Trip_TripStartDate",
		joinColumns={@JoinColumn(name="tripStartDates_id")},  
	    inverseJoinColumns={@JoinColumn(name="trip_id")}
	)
	*
	* 注意:双向修改以为两方都要对关联表数据进行维护，
	* 	也就是对于其他信息进行单独修改也必须带入关联维护信息这样会比较码放
	* 	还是建议有其中一方进行关系维护
	*/
	@UI_Field( showName="线路", relationModel="trips",relationFields= {"tripName"})
	@ManyToMany(mappedBy="tripStartDates")
	public List<Trip> trip ;
}
